package com.lmt_11;

import java.util.*;
import java.util.stream.Collectors;

public class StreamTest {
    public static void main(String[] args) {
        List<String>list = new ArrayList<>();
        Collections.addAll(list,"zhangs","fsddfs","dsdkk","ojij","sfvsf");
        //System.out.println(list);
        List<String> z = list.stream().filter(s -> s.startsWith("z") && s.length() == 6).collect(Collectors.toList()); // 将结果转换成集合
        //System.out.println(z);

        Set<String> set = new HashSet<>();
        Collections.addAll(set,"理论理论","lssl","论文","论以");
        set.stream().filter(s -> s.contains("论")).forEach(s -> System.out.println(s));

        Map<String,Double> map = new HashMap<>();
        map.put("jjj",12.5);
        map.put("ewr",135.2);
        map.put("ds",78.5);
        map.put("fs",8.2);
        map.entrySet().stream().filter(s -> s.getKey().contains("s")).forEach(s -> System.out.println(s));
    }
}
